import request from '@/utils/request';

export type LoginParamsType = {
  userName: string;
  password: string;
  mobile: string;
  captcha: string;
};

export const fakeAccountLogin = (params: LoginParamsType) => {
  return new Promise((resolve, reject) => {
    fetch('http://localhost:3006/api/login/account', {
      body: JSON.stringify(params),
      headers: {
        'content-type': 'application/json',
      },
      method: 'POST',
    })
      .then((res) => res.json())
      .then((res) => {
        resolve(res);
      })
      .catch((error) => {
        reject(error);
      });
  });
};

export async function getFakeCaptcha(mobile: string) {
  return request(`/api/login/captcha?mobile=${mobile}`);
}
